<%@ tag language="java" pageEncoding="UTF-8"
	deferredSyntaxAllowedAsLiteral="false" trimDirectiveWhitespaces="true"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ attribute name="id" required="true" type="java.lang.String"
	description="唯一标识."%>
<%@ attribute name="relationId" required="true" type="java.lang.String"
	description="relationId"%>
<%@ attribute name="formId" required="true" type="java.lang.String"
	description="formId"%>
<%@ attribute name="readonly" required="false" type="java.lang.Boolean"
	description="formId"%>
<%@ attribute name="typeKey" required="false" type="java.lang.String"
	description="typeKey"%>
<%@ taglib prefix="isperp" uri="/WEB-INF/tlds/isperp.tld"%>


<isperp:grid
	url="sparepart/sparepartChangeDetail/listDetails?relationId=${relationId }"
	gridId="${id }Grid" showPager="false" showSearchbar="false"
	cusDialogSize="big" editurl="sparepart/sparepartChangeDetail/save"
	cusDeleteUrl="sparepart/sparepartChangeDetail/delete"
	cusFormatterActions="${!readonly }" showToolbar="${!readonly }"  >
	<jsp:attribute name="toolbar">
		<isperp:toolbar>
			<isperp:button text="新增" icon="icon-plus"
				onclick="$('#${id }Selector').click()"></isperp:button>
		</isperp:toolbar>
		</jsp:attribute>
	<jsp:body>
		<isperp:column name="id" title="id" hidden="true"></isperp:column>
		<isperp:column name="spt_code" title="编号" width="80">
		</isperp:column>
		<isperp:column name="treenode_name_path" title="备件分类" width="100">
		</isperp:column>
		<isperp:column name="spt_name" title="备件名称" width="150">
		</isperp:column>
		<isperp:column name="spt_model" title="规格型号" width="100">
		</isperp:column>
		<isperp:column name="spt_unit" title="单价" width="60">   
		</isperp:column>
		<isperp:column name="cur_stock_quantity" title="当前库存" width="85">
		</isperp:column>
		<c:choose>
		<c:when test="${readonly eq true }">
		<isperp:column name="quantity" title="数量" width="120" editable="true">   
		</isperp:column> 
		<isperp:column name="memo" title="备注" width="120">   
		</isperp:column>
		</c:when>
		
		<c:otherwise>
		<isperp:column name="quantity" title="数量" width="120" editable="true"
					edittype="text" isFormatterFun="true"
					formatter="return getSpInputText(cellvalue, rowObject,2,1);">   
		</isperp:column> 
		<isperp:column name="memo" title="备注" width="120" editable="true"
					edittype="text" isFormatterFun="true"
					formatter="return getSpInputText(cellvalue, rowObject,1);">   
		</isperp:column>
		</c:otherwise>
		
		</c:choose>
		
		
	</jsp:body>
</isperp:grid>
<c:if test="${readonly ne true }">
	<isperp:sparepartSelector relationId="${relationId }" typeKey="${typeKey }"
		gridId="${id }Grid" formId="${formId }" id="${id }Selector"></isperp:sparepartSelector>
</c:if>


